package com.liaogui.内部类;

/**
 * @author liaogui
 * @date 2025/4/13 13:24
 */
public class 匿名内部类 {
    interface Greeting {
        void greet();
    }

    public void sayHello() {
        Greeting greeting = new Greeting() {
            @Override
            public void greet() {
                System.out.println("sayHello");
            }
        };
        greeting.greet();
    }

    public static void main(String[] args) {
        匿名内部类 匿名内部类 = new 匿名内部类();
        匿名内部类.sayHello();
    }

}
